package top.aiprogram.user.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import top.aiprogram.user.dao.UserMapper;
import top.aiprogram.user.entity.User;

/**
 * Created by HP on 2018/10/13.
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;
    /**
    *@Author JackQi {www.coder520.com}
    *@Date 2018/10/15 15:32
    *@Description 创建用户
    */
    @Override
    @Transactional
    public int creatUser(User user) {
        int i = userMapper.insertSelective(user);
        return i;
    }

    /**
    *@Author JackQi {www.coder520.com}
    *@Date 2018/10/15 15:31
    *@Description 根据用户名查找用户
    */
    @Override
    public User findUserByName(String username) {
        User user=userMapper.selectByName(username);
        return user;
    }


}
